package com.foodconflict.action;

import java.util.List;

import com.foodconflict.domain.Conflict;
import com.foodconflict.domain.Food;
import com.foodconflict.service.FoodService;
import com.foodconflict.util.ActionBase;
import com.foodconflict.util.PagedData;
import com.foodconflict.util.PagedResult;

public class FoodListAction extends ActionBase  {
	private FoodService foodService;
	private PagedData pageData;
	private int pageindex;
	private List<Food> result;
	
	public FoodService getFoodService() {
		return foodService;
	}


	public void setFoodService(FoodService foodService) {
		this.foodService = foodService;
	}


	public PagedData getPageData() {
		return pageData;
	}


	public void setPageData(PagedData pageData) {
		this.pageData = pageData;
	}

	public int getPageindex() {
		return pageindex;
	}


	public void setPageindex(int pageindex) {
		this.pageindex = pageindex;
	}


	public List<Food> getResult() {
		return result;
	}


	public void setResult(List<Food> result) {
		this.result = result;
	}


	public String listAll()
	{
		PagedResult<Food> pr = foodService.findFoodList(pageindex, 20);
		result = pr.getResultList();
		pageData = pr.getPagedData();
		return success("listAll");
	}
	
}
